/**
 * Copyright (c) 2018-2019 PoleStar Studio. All Rights Reserved. <br>
 * Use is subject to license terms.<br>
 * <p>
 * 在此处填写文件说明
 */
package edu.javaee.spring.life;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;

/**
 * 所有Bean的初始化处理器.
 * <p>说明.<br>
 *     1、预初始化方法 postProcessBeforeInitialization
 *     2、后初始化方法 postProcessAfterInitialization
 * @version v1.0
 * @author lianzuozheng
 * @date 2019-03-25 -9:28 
 */
public class MyBeanPostProcessor implements BeanPostProcessor{


    @Override
    public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {

        //针对所有bean进行预初始化
        System.out.println("6.bean进行预初始化 " + beanName);
        return bean;
    }

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        // 针对所有bean进行后初始化
        System.out.println("9.bean进行后初始化" + beanName);
        return bean;
    }

}
